<?php

class StaticPagesModule extends fvModule {

    function __construct () {
        $moduleName = strtolower(substr(__CLASS__, 0, -6));

        parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
                            fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
                            fvSite::$Layoult);
    }

    function showIndex() {
    	$this->__assign('StaticPages', StaticPagesManager::getInstance()->getAll("lang='".fvSite::$fvSession->get("lang")."'", "IF (parent = 0, id*100000, parent*100000 + id)"));
        if (!$Page = StaticPagesManager::getInstance()->getByPk(fvRequest::getInstance()->getRequestParameter('id'))) {
        	$Page = new StaticPages();
        }
        $this->__assign('Page', $Page);
        $this->__assign('current_lang', fvSite::$fvSession->get("lang"));
        $this->__assign('StaticPagesManager', StaticPagesManager::getInstance());
        $editor = new fvCKEditor();
        fvCKFinder::SetupCKEditor( $editor, '/ckfinder/' ) ;
        $this->__assign('editor', $editor->editor("sp[content]", "sp_content", stripslashes($Page->content)));
        return $this->__display('staticpages_list.tpl');
    }

}

?>
